package org.rcloud.io.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import org.rcloud.io.Utils.PageVo;
import org.rcloud.io.Utils.ResultVo;
import org.rcloud.io.mapper.Activity_copyMapper;
import org.rcloud.io.model.Activity_copy;
import org.rcloud.io.service.Activity_copyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2019/3/2.
 */
@Service(value = "Activity_copyService")
public class Activity_copyServiceImpl implements Activity_copyService{
    @Autowired
    private Activity_copyMapper activity_copyMapper;

    @Override
    public ResultVo deleteByPrimaryKey(Activity_copy id) {

        try {
            int primaryKey = activity_copyMapper.deleteByPrimaryKey(id);
            return ResultVo.setOK(primaryKey);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultVo.setError(e.getMessage());
        }
    }

    @Override
    public ResultVo insert(Activity_copy record) {
        try {
            int primaryKey = activity_copyMapper.insert(record);
            return ResultVo.setOK(primaryKey);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultVo.setError(e.getMessage());
        }

    }

    @Override
    public ResultVo insertSelective(Activity_copy record) {
        try {
            int primaryKey = activity_copyMapper.insertSelective(record);
            return ResultVo.setOK(primaryKey);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultVo.setError(e.getMessage());
        }
    }

    @Override
    public ResultVo selectByPrimaryKey(Activity_copy id) {

        try {
            Activity_copy activityCopy = activity_copyMapper.selectByPrimaryKey(id);
            return ResultVo.setOK(activityCopy);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultVo.setError(e.getMessage());
        }
    }

    @Override
    public PageVo<Activity_copy> selectByActid(String actid) {
        try {
            List<Activity_copy> list = activity_copyMapper.selectByActid(actid);
            return PageVo.setOk(list);
        } catch (Exception e) {
            e.printStackTrace();
            return PageVo.setError(e.getMessage());
        }
    }

    @Override
    public ResultVo updateByPrimaryKeySelective(Activity_copy record) {

        try {
            int i = activity_copyMapper.updateByPrimaryKeySelective(record);
            return ResultVo.setOK(i);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultVo.setError(e.getMessage());
        }

    }

    @Override
    public ResultVo updateByPrimaryKey(Activity_copy record) {

        try {
            int i = activity_copyMapper.updateByPrimaryKey(record);
            return ResultVo.setOK(i);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultVo.setError(e.getMessage());
        }
    }

    @Override
    public PageInfo<Activity_copy> selectByOther(JSONObject params){
        List<Activity_copy> activity_copyList = activity_copyMapper.selectByOther(params);
        PageInfo<Activity_copy> pageInfo= new PageInfo<>(activity_copyList);
        return pageInfo;
    }
}
